﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DevTool.Operation
{
    public class IntroduceOperation
    {
        static Hashtable htPages = new Hashtable();

        public static void SwitchStyle(string style, TabControl tabControl_tool)
        {
            if (style == "工作模式")
            {
                var workTab = "计划生成工具,日志生成工具".Split(',');
                foreach (var tabStrName in workTab)
                {
                    AddPage(tabStrName, tabControl_tool);
                    htPages.Remove(tabStrName);
                }
            }
            if (style == "开发模式")
            {
                var workTab = "计划生成工具,日志生成工具".Split(',');
                foreach (var tabStrName in workTab)
                {
                    foreach (TabPage tabPage in tabControl_tool.TabPages)
                    {
                        if (tabPage.Text == tabStrName)
                        {
                            tabControl_tool.TabPages.Remove(tabPage);
                            htPages.Add(tabStrName, tabPage);
                            break;
                        }
                    }
                }

            }
        }

        public static void AddPage(string tabStrName, TabControl tabControl_tool)
        {
            TabPage tabPage = (TabPage)htPages[tabStrName];
            if (tabPage != null)
            {
                tabControl_tool.TabPages.Add(tabPage);
            }
        }
    }
}
